/**
 * 
 */
package org.vsg.stock.extension.service;

import java.util.Collection;
import java.util.Date;
import java.util.List;

import org.vsg.common.exceptions.service.ServiceException;
import org.vsg.stock.extension.vo.AttentionBlock;
import org.vsg.stock.extension.vo.CloserPatternStock;
import org.vsg.stock.extension.vo.LinkageCateShownSequenceVO;
import org.vsg.stock.extension.vo.LinkageCateStockVO;
import org.vsg.stock.extension.vo.LinkageStockGroup;
import org.vsg.stock.extension.vo.LinkageStockGroupCounterVO;
import org.vsg.stock.extension.vo.LinkageStockGroupCounterView;

/**
 * @author vison
 *
 */
public interface StockAnalysisService {
	
	/**
	 * find handle cycle defined
	 * @param code
	 * @param date
	 * @param cycle
	 * @return
	 * @throws ServiceException
	 */
	Collection<CloserPatternStock> findHistoryPatternStocks(String code , Date date , int cycle , int shapeCycle) throws ServiceException;	
	
	/**
	 * 
	 * @param date
	 * @return
	 * @throws ServiceException
	 */
	LinkageStockGroup findStockGroupByDate(Date date) throws ServiceException;

	/**
	 * 
	 * @param date
	 * @param minimumTogetherNumber
	 * @return
	 * @throws ServiceException
	 */
	LinkageStockGroup findStockGroupByDate(Date date , int minimumTogetherNumber) throws ServiceException;
	
	/**
	 * 
	 * @param fromDate
	 * @param toDate
	 * @param minimumTogetherNumber
	 * @return
	 * @throws ServiceException
	 */
	List<LinkageStockGroup> findStockGroupListInPeriod(Date fromDate , Date toDate , int minimumTogetherNumber) throws ServiceException;
	
	/**
	 * 
	 * @param fromDate
	 * @param toDate
	 * @param minimumTogetherNumber
	 * @return
	 * @throws ServiceException
	 */
	List<LinkageStockGroupCounterVO> findStockGroupCounterInPeriod(Date fromDate , Date toDate , int minimumTogetherNumber) throws ServiceException;
	
	/**
	 * 
	 * @param fromDate
	 * @param cycle
	 * @return
	 * @throws ServiceException
	 */
	List<LinkageStockGroupCounterView> findFrequencyLinkageStockGroup(Date fromDate , int cycle) throws ServiceException;
	
	/***
	 * 
	 * @param fromDate
	 * @param cycle
	 * @param recent
	 * @return
	 * @throws ServiceException
	 */
	List<LinkageStockGroupCounterView> findFrequencyLinkageStockGroup(Date fromDate , int cycle , int recent) throws ServiceException;
	
	
	/**
	 * 
	 * @param fromDate
	 * @param cycle
	 * @param type
	 * @return
	 * @throws ServiceException
	 */
	List<LinkageStockGroupCounterView> findLinkageStockGroupCounterViewInFrontOf(Date fromDate , int cycle , String type) throws ServiceException;
	
	/**
	 * 
	 * @param fromDate
	 * @param cycle
	 * @param notInFrontOfCycle
	 * @param type
	 * @return
	 * @throws ServiceException
	 */
	List<LinkageStockGroupCounterView> findLinkageStockGroupCounterViewInFrontOf(Date fromDate , int cycle , int notInFrontOfCycle, String type) throws ServiceException;
	
	/**
	 * 
	 * @param fromDate
	 * @param cycle
	 * @param notInFrontOfCycle
	 * @param type
	 * @return
	 * @throws ServiceException
	 */
	List<LinkageStockGroupCounterView> findAllLinkageStockGroupCounterViewInFrontOf(Date fromDate , int cycle , int chartsCycle) throws ServiceException;
	
	/**
	 * 
	 * @param fromDate
	 * @return
	 * @throws ServiceException
	 */
	List<LinkageStockGroupCounterView> findAllLinkageStockGroupCounterViewInFrontOf(Date fromDate) throws ServiceException;
	
	/**
	 * 
	 * @param fromDate
	 * @param cycle
	 * @param cateDesc
	 * @return
	 * @throws ServiceException
	 */
	List<LinkageCateShownSequenceVO> findCateShownSequenceByCategoryDesc(Date fromDate , int cycle , String cateDesc) throws  ServiceException;

	/**
	 * 
	 * @param fromDate
	 * @param cycle
	 * @param cateDesc
	 * @return
	 * @throws ServiceException
	 */
	List<LinkageCateStockVO> findCateStockByCategoryDesc(Date fromDate , int cycle , String cateDesc) throws  ServiceException;

	/**
	 * 
	 * @param orgList
	 * @param ab
	 * @throws ServiceException
	 */
	void saveAttentionBlock(List<AttentionBlock> orgList , AttentionBlock ab) throws ServiceException;
	
	/**
	 * 
	 * @param assoAttentionBlock
	 * @return
	 * @throws ServiceException
	 */
	List<LinkageCateStockVO> analyseStocksFromAttentionBlock(List<AttentionBlock> assoAttentionBlock) throws ServiceException;
	
}
